package com.dog.basics.admin.controller.common;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dog.basics.bean.dto.admin.common.ArticleCommentFormDto;
import com.dog.basics.bean.vo.admin.common.PcArticleCommentVo;
import com.dog.basics.common.annotation.SysLog;
import com.dog.basics.common.constant.SwaggerConstants;
import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.util.R;
import com.dog.basics.service.common.IDogComArticleCommentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * <p>
 * CMS评论表 前端控制器
 * </p>
 *
 * @author guonh
 * @since 2020-05-23
 */
@RestController
@RequestMapping("/admin/article/comment")
@Api(value = SwaggerConstants.COMMON+"CMS文章模块", tags = SwaggerConstants.COMMON+"CMS文章模块")
@AllArgsConstructor
@ApiIgnore
public class DogComArticleCommentController {

    private final IDogComArticleCommentService dogComArticleCommentService;
/*    *//**
     * @Description: 增加cms文章评论
     * @Param:
     * @return: Boolean
     * @Author: zhangrm
     * @Date: 2020/05/22  0027
     *//*
    @SysLog("增加cms文章评论")
    @ApiOperation(value = "增加cms文章评论", notes = "pc:articlecomment:save")
    @PostMapping("/save")
    @PreAuthorize("@pms.hasPermission('pc:articlecomment:save')")
    public R<Boolean> save(@Valid @RequestBody ArticleCommentAddDto obj) {
        return R.ok(dogComArticleCommentService.saveObj(obj));
    }*/

    /**
     * @Description: 删除cms文章评论
     * @Param: ids
     * @return: Boolean
     * @Author: zhangrm
     * @Date: 2020/05/22  0027
     */
    @SysLog("删除cms文章评论")
    @ApiOperation(value = "删除cms文章评论", notes = "pc:articlecomment:delete")
    @ApiImplicitParam(value = "cms文章评论Id", name = "id", dataType = "Long", required = true)
    @DeleteMapping("/delete/{id}")
    @PreAuthorize("@pms.hasPermission('pc:articlecomment:delete')")
    public R<Boolean> delete(@PathVariable("id") Long id) {
        return R.ok(dogComArticleCommentService.deleteObj(id));
    }


/*    *//**
     * @Description: 修改cms文章评论
     * @Param:
     * @return: Boolean
     * @Author: zhangrm
     * @Date: 2020/05/22  0027
     *//*
    @SysLog("修改cms文章评论")
    @ApiOperation(value = "修改cms文章评论", notes = "pc:articlecomment:edit")
    @PutMapping("/edit")
    @PreAuthorize("@pms.hasPermission('pc:articlecomment:edit')")
    public R<Boolean> edit(@Valid @RequestBody ArticleCommentEditDto obj) {
        return R.ok(dogComArticleCommentService.editObj(obj));
    }*/

    /**
     * @Description: 分页cms文章评论列表
     * @Param: status
     * @return: IPage<PcArticleCommentVo>
     * @Author: zhangmr
     * @Date:
     */
    @ApiOperation(value = "分页cms文章评论列表", notes = "pc:articlecomment:page")
    @GetMapping("/page")
    @PreAuthorize("@pms.hasPermission('pc:articlecomment:page')")
    public R<IPage<PcArticleCommentVo>> page(PageParam page, ArticleCommentFormDto ArticleCommentFormDto) {
        IPage<PcArticleCommentVo> list = dogComArticleCommentService.getPageList(page, ArticleCommentFormDto);
        return R.ok(list);
    }

}
